package com.truthbean.jeetb.cms.sys.servlet.ueditor;

import com.baidu.ueditor.ActionEnter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by TruthBean on 2016-10-09 17:37.
 */
@WebServlet("/plugin/ueditor/config.json") //不知道这种url会不会出问题😂
public class UEditorServlet extends HttpServlet {

    @Override
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //super.service(request, response); 这句不能添加
        request.setCharacterEncoding("utf-8");
        response.setHeader("Content-Type", "text/html");
        String rootPath = request.getServletContext().getRealPath("/");
        System.out.println(rootPath);
        response.getWriter().print(new ActionEnter(request, rootPath).exec());
    }

}
